//
//  TouchView.m
//  UI22_复习Block
//
//  Created by Scott on 16/4/8.
//  Copyright © 2016年 Scott. All rights reserved.
//

#import "TouchView.h"

@interface TouchView ()

@property (nonatomic, copy) void (^handleClick)(TouchView *);


@end

@implementation TouchView




#pragma mark - override touch
- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    
    [super touchesEnded:touches withEvent:event];
    
    // 调用Block
    self.handleClick(self);
}

#pragma mark - Creating and Init
- (instancetype)initWithFrame:(CGRect)frame clickHandle:(void (^)(TouchView *view))handle {
    
    self = [super initWithFrame:frame];
    
    if (self) {
        
        self.handleClick = handle;
        
    }
    return self;
}










@end
